<?php
namespace tool;
class M3Result {
    public $code = 0;
    public $msg = '成功';
    public $app_key = 'zsq12345678';
    public $timestamp;
    public $sign;
    public $paramss = '';//加密之后的参数,不加密为空
    /**
     *
     *XCFOa5TtZsEAerS2vmJAZQ==
     */
    public function toJson($_param='')
    {
        $aes = new AesCode();
        //参数变为字符串
        $_params = json_encode($_param);
        //生成签名
        $this->timestamp = time();
        $this->sign = $aes->createSign($this->app_key,$this->timestamp,$_params);
        //加密参数
//    if($_param)
//    {
        $this->paramss = $aes->encode($_params);
//    }
        return json_encode($this, JSON_UNESCAPED_UNICODE);
    }
}